type custom_t<T> = T

fn sum<T>(T a, T b):T {
    return a + b
}

fn list_sum<T>([T] list):T {
    T sum = 0
   	for k,v in list {
   		sum += v
   	}
   	return sum
}

// 类型参数
type box<T, U> = struct {
	T width
	U length
}

type person_t<T> = struct {
    custom_t<i8> age
    T name
}

// 泛型函数
fn area<T, U>(box<T, U> b):T {
    return b.width * b.length as T
}

// 类型扩展
fn box<T, U>.perimeter():T {
    return (self.width + self.length as T) * 2
}